#!/usr/bin/python
import MySQLdb
import solar

reader = solar.SolarReader()
db = MySQLdb.connect(host="127.0.0.1", user="root", db="solar", port=3306)
data = reader.getEnergy()
cursor = db.cursor()
cursor.execute("""INSERT INTO solar_data (watts, kwh_today, kwh_lifetime)
		VALUES (%s,%s,%s)""", (data[0], data[1], data[2]))
cursor.close()
db.close()
